﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace JNPF.Basics.Models.System.Dtos.ModuleDataAuthorizeScheme
{
    public class ModuleDataAuthorizeSchemeCrInput
    {
        /// <summary>
        /// 功能主键
        /// </summary>
        [Required(ErrorMessage = "功能主键不能为空")]
        public string moduleId { get; set; }
        /// <summary>
        /// 方案名称
        /// </summary>
        [Required(ErrorMessage = "方案名称不能为空")]
        public string fullName { get; set; }
        /// <summary>
        /// 方案对象
        /// </summary>
        [Required(ErrorMessage = "方案对象不能为空")]
        public string conditionJson { get; set; }
        /// <summary>
        /// 方案对象描述
        /// </summary>
        [Required(ErrorMessage = "方案对象描述不能为空")]
        public string conditionText { get; set; }
        public string id { get; set; }
    }

    public class ConditionJsonItem
    {
        /// <summary>
        /// 逻辑
        /// </summary>
        [Required(ErrorMessage = "逻辑不能为空")]
        public string logic { get; set; }
        /// <summary>
        /// 组
        /// </summary>
        [Required(ErrorMessage = "组不能为空")]
        public List<GroupsItem> groups { get; set; }
    }

    public class GroupsItem
    {
        /// <summary>
        /// id
        /// </summary>
        [Required(ErrorMessage = "id不能为空")]
        public string id { get; set; }
        /// <summary>
        /// 字段
        /// </summary>
        [Required(ErrorMessage = "字段不能为空")]
        public string field { get; set; }
        /// <summary>
        /// 类型
        /// </summary>
        [Required(ErrorMessage = "类型不能为空")]
        public string type { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage = "op不能为空")]
        public string op { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage = "value不能为空")]
        public string value { get; set; }
    }
}
